Clear CURLOPT_CUSTOMREQUEST in get() and post() to fix request method persistence #111
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When reusing a Curl object instance,
CURLOPT_CUSTOMREQUESTset by PUT/PATCH/DELETE persisted across requests, causing subsequent GET/POST requests to use incorrect methods or carry over POST data.Changes
get()method: SetCURLOPT_CUSTOMREQUESTtonull(was"GET") and clearCURLOPT_POSTFIELDSpost()method: SetCURLOPT_CUSTOMREQUESTtonull(was"POST")Per cURL documentation, standard methods should use
CURLOPT_HTTPGET/CURLOPT_POST, notCURLOPT_CUSTOMREQUEST. Setting tonullclears previous custom methods.Example
Added
SequentialRequestsTest.phpcovering GET/POST after PUT/PATCH/DELETE scenarios.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/repos/doctrine/instantiator/zipball/c6222283fa3f4ac679f8b9ced9a4e23f163e80d0/usr/bin/php8.3 -n -c /tmp/r8gnS3 /usr/bin/composer install(http block)https://api.github.com/repos/nikic/PHP-Parser/zipball/3a454ca033b9e06b63282ce19562e892747449bb/usr/bin/php8.3 -n -c /tmp/r8gnS3 /usr/bin/composer install(http block)https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c/usr/bin/php8.3 -n -c /tmp/r8gnS3 /usr/bin/composer install(http block)https://api.github.com/repos/theseer/tokenizer/zipball/737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2/usr/bin/php8.3 -n -c /tmp/r8gnS3 /usr/bin/composer install(http block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.